
export const init = (self, tiyData) => {

}

export const webList = (self, tiyData) => {
  self.$Spin.show();
  tiyData.tData.productList.splice(0,tiyData.tData.productList.length );
  self.$apiProduct.recycleBin({
    "pageSize": tiyData.tPage.stepNumber,
    "pageNum": tiyData.tPage.currentPage,
    "productCode": tiyData.tParam.productCode,
    "is_prefer": -2,
    "choosed_classify": tiyData.tParam.selectedClassification,
    "classifyLevel": tiyData.tParam.classificationLevel,
    "sortHidden": tiyData.tParam.orderBy
  })
    .then(function (response) {
      self.$Spin.hide();
      if (response.success) {
        tiyData.tParam.length = [];
        tiyData.tData.productList.length = 0;
        let productPage = response.result;
        tiyData.tPage.total = productPage.total;
        tiyData.tPage.stepNumber = productPage.pageSize;
        productPage.list.forEach(
          function (item) {
            tiyData.tData.productList.push(item);
          }
        );
        if (0 == tiyData.tData.productList.length) {
          self.$Message.error("查询没有结果");
        }
      } else {
        self.$Spin.hide();
        self.$Message.error(response.errorMessage);
      }
    });

};
export const actionBackProduct=(self,tiyData)=>{
  self.$Spin.show();
  self.$apiProduct.findBackProduct({
    "productId":tiyData.tStatus.actionModal.productId,
    "productCode":tiyData.tStatus.actionModal.productCode
  }).then(function (response) {
      if(response.success){
        self.$Message.success("操作成功!");
        webList(self,tiyData);
      }else{
        self.$Message.error(response.errorMessage);
      }
    self.$Spin.hide();

    })

}

export const realDelete=(self,tiyData)=>{
  self.$Spin.show();
  self.$apiProduct.realDeleteProduct({
    "productId":tiyData.tStatus.actionModal.productId,
    "productCode":tiyData.tStatus.actionModal.productCode
  }).then(function (response) {
    self.$Spin.hide();
    if(response.success){
      self.$Message.success("操作成功!");
      webList(self,tiyData);
    }else{
      self.$Spin.hide();
      self.$Message.error(response.errorMessage);
    }

  })

}
